
public class ClosestPoints
{

   /**
    * @param args
    */
   public static void main(String[] args)
   {
      //int x_array[] = {0,1,2,3,4,5,6,7,8,9,10};
      //int y_array[] = {0,12,34,-48,15,347,8,5,3,2,1};
      
      //int x_array[] = {0,1,2,3,4,5,6,9,8,7,10};
      //int y_array[] = {0,12,34,-48,15,347,8,2,3,5,1};
      
      int x_array[] = {0,1};
      int y_array[] = {0,1};
      
      //int x_array[] = { 0,1,0};
      //int y_array[] = {0,1,0};
      
      double smallest_distance = Integer.MAX_VALUE;
      double current_distance = 0;
      
      int result[] = {0,0};
      
      for(int i=0;i<x_array.length-1;i++)
      {
         int x1 = x_array[i];
         int y1 = y_array[i];
         
         int x2 = x_array[i+1];
         int y2 = y_array[i+1];
         
         current_distance = Math.sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
         if(current_distance < smallest_distance)
         {
            smallest_distance = current_distance;
            result[0] = i;
            result[1] = i+1;
         }  
      }
      System.out.println(result[0] + " " + result[1]);
   }

}
